//
//  APIClient+Version.swift
//  LiteAccount
//
//  Created by 刘伟 on 2017/6/23.
//  Copyright © 2017年 刘伟. All rights reserved.
//

import Alamofire

extension APIClient {
    
    // MARK: 登录接口
    func fetchVersion(params: [String: Any], getResponse:@escaping (_ result: ClientResponseType) -> Void) {
        let requestUrl = APIURL + "Version.GetVersion"
        defaultRequest(url: requestUrl, params: params, showMessage: false) { (result) in
            var response = result
            var version: VersionModel!
            var currentMessage = ""
            switch result {
            case let .success(info, message):
                let json = info as! JSON
                version = VersionModel(json: json)
                currentMessage = message
            default:
                version = VersionModel()
            }
            response = .success(version as AnyObject, currentMessage)
            getResponse(response)
        }
    }

}
